package com.zengqingfa.demo.listener;

import com.zengqingfa.demo.event.MyEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;

/**
 * @author zengqingfa
 * @date 2019/11/22 13:28
 * @description
 * @email zengqingfa_java@163.com
 * <p>
 * 手动向springbootappplicatio添加监听,在配置文件中添加
 */
public class MyListener1 implements ApplicationListener<MyEvent> {

    Logger logger = LoggerFactory.getLogger(MyListener1.class);

    @Override
    public void onApplicationEvent(MyEvent event) {
        logger.info(String.format("%s监听到事件源：%s.", MyListener1.class.getName(), event.getSource()));
    }
}
